package com.itic.ht.cms.examrecord.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.itic.appbase.framework.common.constants.ResponseCode;
import com.itic.ht.cms.examrecord.persistence.dao.ExamQuestionDao;
import com.itic.ht.cms.examrecord.persistence.model.ExamQuestion;
import com.itic.ht.cms.examrecord.persistence.model.ExamQuestionExample;

@Service
@Transactional
public class ExamQuestionService {
	
	 protected static final String SUCCESS = ResponseCode.SUCCESS.getCode();
	 protected static final String FAILED = ResponseCode.SERVICE_ERROR.getCode();

	@Autowired
	private ExamQuestionDao mapper;
	
	public int count(ExamQuestionExample example) {
		return mapper.countByExample(example);
	}

	public List<ExamQuestion> list(ExamQuestionExample example) {
		return mapper.selectByExample(example);
	}

	public String add(ExamQuestion examQuestion) {
		int code = mapper.insert(examQuestion);
        if (1 == code) {
            return SUCCESS;
        } else if (0 == code) {
            return FAILED;
        } else {
            return FAILED;
        }
	}
	
}
